import Vue from 'vue'
import Router from 'vue-router'

import Main from '../views/Main'
import Login from '../views/Login'

import List from '../views/user/List'
import Profile from '../views/user/Profile'
import NotFound from '../views/NotFound'


Vue.use(Router);

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/main/:name',
            component: Main, //嵌套路由
            props: true,
            children: [
                {
                    path: "/user/profile",
                    name: Profile,
                    component: Profile,
                    props: true
                },
                {
                    path: "/user/list",
                    component: List
                }
            ]
        },
        {
            path: '/login',
            component: Login
        },
        {
            path: '/gohome',
            redirect: '/main'
        },
        {
            path: '*',
            component: NotFound
        }
    ]
})